﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            Cat cat = new Cat();
            a(cat);
            t(cat);
            Console.WriteLine();

            Dog dog = new Dog();
            a(dog);
            s(dog);
            Console.WriteLine();

            Duck duck = new Duck();
            a(duck);
            s(duck);
            Console.WriteLine();

            Monkey monkey = new Monkey();
            a(monkey);
            t(monkey);

            Console.ReadLine();
        }
        public static void t(Tree t)
        {
            t.Tree();
        }
        public static void s(Swim s)
        {
            s.Swim();
        }
        public static void a(Animal a)
        {
            a.Eat();
        }
    }
    class Monkey : Animal, Tree
    {
        public override void Eat()
        {
            Console.WriteLine("我吃香蕉");
        }

        public void Tree()
        {
            Console.WriteLine("我会爬树");
        }
    }
    class Duck : Animal, Swim
    {
        public override void Eat()
        {
            Console.WriteLine("我吃饲料");
        }

        public void Swim()
        {
            Console.WriteLine("我会游泳");
        }
    }
    class Dog : Animal, Swim
    {
        public override void Eat()
        {
            Console.WriteLine("我吃狗粮");
        }

        public void Swim()
        {
            Console.WriteLine("我会游泳");
        }
    }
    class Cat : Animal, Tree
    {
        public override void Eat()
        {
            Console.WriteLine("我吃猫粮");
        }

        public void Tree()
        {
            Console.WriteLine("我会爬树");
        }
    }
    abstract class Animal
    {
        public abstract void Eat();
    }

}
